package tech.aistar.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import tech.aistar.mapper.UserMapper;
import tech.aistar.pojo.User;

import java.util.concurrent.TimeUnit;
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private JavaMailSender mailSender;
    @Autowired
    RedisTemplate redisTemplate;

    @Override
    public User findByUsername(String username) {
        return userMapper.findByUsername(username);
    }
    @Async//异步任务
    @Override
    public void sendPwdHash(String pwd) {
       redisTemplate.opsForValue().set("pwd", pwd,30, TimeUnit.MINUTES);
//

    }
}
